home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 031a / wgraf102.zip / GRAPH.HPP < prev    next >
C/C++ Source or Header  |  1991-01-29  |  7KB  |  207 lines

  1. class windows;
  2. extern windows *windowpointer;
  3.  
  4. class gui {
  5. friend class point;
  6. friend class line;
  7. friend class windows;
  8. friend class boxes;
  9. friend class font;
  10.     unsigned char *screen_buffer[4];
  11.     unsigned char far *graph_driver;        // stores the graphics driver file
  12.     unsigned int graph_driver_pointer;
  13.     // pointer to the current position in the graphics driver
  14.  
  15.     void find_func(void);
  16.     // locates the next function in the graphics driver
  17.  
  18.     void (far *fill_screen_ptr)(unsigned char color);
  19.     // fills the screen with the specified color
  20.  
  21.     void (far *set_mode_ptr)(void);
  22.     // sets the graphics mode
  23.  
  24.     void (far *out_bitmask_ptr)(unsigned int x, unsigned int y, unsigned char color,
  25.         unsigned char *bitmask, unsigned int height, unsigned char text);
  26.     // used for outputting characters to the screen in a graphics mode
  27.  
  28.     void (far *point_put_ptr)(unsigned int x, unsigned int y, unsigned char color);
  29.     // outputs a pixel to the screen
  30.  
  31.     void (far *line_put_ptr)(unsigned int x1, unsigned int y1, unsigned int x2,
  32.         unsigned int y2, unsigned char color);
  33.     // draws a line on the screen
  34.  
  35.     void (far *horizontal_line_ptr)(unsigned int x1, unsigned int y1,
  36.         unsigned int x2, unsigned char color);
  37.     // draws a horizontal line on the screen
  38.  
  39.     void (far *vertical_line_ptr)(unsigned int y1, unsigned int x1,
  40.         unsigned int y2, unsigned char color);
  41.     // draws a vertical line on the screen
  42.  
  43.     void (far *filled_box_ptr)(unsigned int x1, unsigned int y1, unsigned int x2,
  44.         unsigned int y2, unsigned char color);
  45.     // draws a filled box on the screen
  46.  
  47.     void (far *scroll_up_ptr)(unsigned int x1, unsigned int y1, unsigned int x2,
  48.         unsigned int y2, unsigned char color, unsigned int lines);
  49.     // scrolls the screen up
  50.  
  51.     void (far *scroll_down_ptr)(unsigned int x1, unsigned int y1, unsigned int x2,
  52.         unsigned int y2, unsigned char color, unsigned int lines);
  53.  
  54.     void (far *save_full_screen)(unsigned char *buffer[4]);
  55.  
  56.     void (far *restore_full_screen)(unsigned char *buffer[4]);
  57.  
  58.     unsigned int (far *screen_mem)(void);
  59.  
  60. public:
  61.     int (far *set_fli_mode)(void);
  62.     // attempts to set mode 13 and returns the value 0 if unsuccessful
  63.  
  64.     void (far *highlight_window)(unsigned int x1, unsigned int y1,
  65.         unsigned int x2, unsigned int y2);
  66.     // highlights a window
  67.  
  68.     int (far *set_gif_mode)();
  69.  
  70.     void (far *output_raster)(unsigned char *raster_data, unsigned int length);
  71.  
  72.     unsigned long (far *window_memory)(unsigned int x1, unsigned int y1,
  73.         unsigned int x2, unsigned int y2);
  74.  
  75.     void (far *save_window)(unsigned char *window_buffer[4], unsigned int x1,
  76.         unsigned int y1, unsigned int x2, unsigned int y2);
  77.  
  78.     void (far *write_window)(unsigned char *window_buffer[4], unsigned int x1,
  79.         unsigned int y1, unsigned int x2, unsigned int y2);
  80.  
  81.     void read(char *path);
  82.     // loads the graphics driver file
  83.  
  84.     void fill_screen(unsigned char color);
  85.     // fills the screen with the specified color
  86.  
  87.     void set_mode(void);
  88.     // sets the video mode
  89.  
  90.     void text_mode(void);
  91.     // sets text mode
  92.  
  93.     void scroll(unsigned int x1, unsigned int y1, unsigned int x2,
  94.         unsigned int y2, unsigned char color, int lines);
  95.     // scrolls the screen
  96.  
  97.     void save_screen(void);
  98.     void restore_screen(void);
  99. };
  100.  
  101. extern gui main_gui;
  102.  
  103. class point {
  104. public:
  105.     void put(unsigned int x, unsigned int y, unsigned char color);
  106. };
  107.  
  108. class line : public point {
  109. public:
  110.     void put(unsigned int x1, unsigned int y1, unsigned int x2,
  111.         unsigned int y2, unsigned char color);
  112. };
  113.  
  114.  
  115. class boxes : public line {
  116. public:
  117.     void check(unsigned int x, unsigned int y);
  118.     void uncheck(unsigned int x, unsigned int y);
  119.     void box(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2,
  120.         unsigned char color);
  121.     void check_box(char *text, unsigned char parameter,
  122.         unsigned int x,
  123.         unsigned int y,
  124.         unsigned char color);
  125.     void filled_box(unsigned int x1, unsigned int y1, unsigned int x2,
  126.         unsigned int y2, unsigned char fillcolor);
  127.     void radio_button(char *text, unsigned int x1, unsigned int y1,
  128.         unsigned int x2, unsigned int y2);
  129. };
  130.  
  131.  
  132. class windows : public boxes {
  133. // defines a windows on the screen
  134. public:
  135.     enum opts {
  136.         none=               0,
  137.         vertical_center=    0x0001,
  138.         horizontal_center=  0x0002,
  139.         auto_scroll_up=     0x0004,
  140.         auto_scroll_down=   0x0008
  141.     };
  142. private:
  143.     enum opts formatting_options;
  144. public:
  145.     unsigned int cursor;
  146.     unsigned char border_color1;
  147.     unsigned char border_color2;
  148.     unsigned int border_width;
  149.     unsigned int x_indent;
  150.     unsigned int y_indent;
  151.     unsigned int x1;
  152.     unsigned int y1;
  153.     unsigned int x2;
  154.     unsigned int y2;
  155.     unsigned int current_x;
  156.     unsigned int current_y;
  157.     unsigned char current_color;
  158.     unsigned char background_color;
  159.     unsigned char *windows_buffer[4];   // saved windows data
  160.     void reset(void);
  161.     void put_cursor(unsigned int x=windowpointer->current_x,
  162.         unsigned int y=windowpointer->current_y,
  163.         unsigned char color=windowpointer->current_color);
  164.     void remove_cursor(unsigned int x=windowpointer->current_x,
  165.         unsigned int y=windowpointer->current_y,
  166.         unsigned char background=windowpointer->background_color);
  167.     void text(unsigned char text, unsigned int andwith=0,
  168.         unsigned int x=windowpointer->current_x,
  169.         unsigned int y=windowpointer->current_y,
  170.         unsigned char color=windowpointer->current_color,
  171.         unsigned char background=windowpointer->background_color);
  172.     void text(char *text, unsigned int andwith=0,
  173.         unsigned int x=windowpointer->current_x,
  174.         unsigned int y=windowpointer->current_y,
  175.         unsigned char color=windowpointer->current_color,
  176.         unsigned char background=windowpointer->background_color);
  177.     windows(void);
  178.     windows(unsigned int xx1, unsigned int yy1, unsigned int xx2,
  179.         unsigned int yy2, unsigned char color=7, unsigned char background=0,
  180.         enum opts options=none);
  181.     void set_window(unsigned int xx1, unsigned int yy1, unsigned int xx2,
  182.         unsigned int yy2, unsigned char color=7, unsigned char background=0,
  183.         enum opts options=none);
  184.     void border(unsigned char color=15, unsigned char color2=8,
  185.         unsigned int width=3);
  186.     void scroll(int lines);
  187.     void save(void);
  188.     void restore(void);
  189.     void setf(enum opts options);
  190.     void unsetf(enum opts options);
  191. };
  192.  
  193.  
  194. class font : public boxes {
  195.     char name[12];
  196.     char bitmap[256][16];
  197. public:
  198.     void put_char(unsigned char text, unsigned int x, unsigned int y,
  199.         unsigned char color, unsigned int andwith, unsigned char background);
  200.     int width, height;
  201.     font(unsigned int x, unsigned int y);
  202.     void load_font(char *text);
  203.     friend class windows;
  204. };
  205.  
  206. extern font *fontpointer;
  207.